//
//  M_CatalogCell.swift
//  letuofu
//
//  Created by WH-JS on 2019/12/13.
//  Copyright © 2019 WH-JS. All rights reserved.
//

import UIKit

class M_CatalogCell: QuickTableCellWithInit<[String:Any?]> {
    let nameLabel = UILabel()
    let selView = UIView()
    
    override class func heightOf(_ data:[String:Any?])->CGFloat{
        return 52
    }

    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
        if selected {
            nameLabel.font = .systemFont(ofSize: 15)
            nameLabel.textColor = .xFC4C02
            selView.backgroundColor = .xFC4C02
            self.backgroundColor = .white
        }
        else {
            nameLabel.font = .systemFont(ofSize: 12)
            nameLabel.textColor = .x666666
            selView.backgroundColor = .clear
            self.backgroundColor = .clear
        }
    }
    
    override func initCell(container: UIView) {
        container.drawLabel(label: nameLabel, text: "", fontSize: 12, fontWeight: .medium, textColor: .x333333){ (make) in
            make.center.equalToSuperview()
            make.left.right.equalToSuperview()
        }
        nameLabel.numberOfLines = 2
        nameLabel.textAlignment = .center
        
        //画线
        container.drawView(view: selView) { (make) in
            make.left.equalToSuperview()
            make.centerY.equalToSuperview()
            make.width.equalTo(3)
            make.height.equalTo(15)
        }
        selView.backgroundColor = .clear
        selView.layer.cornerRadius = 1.5
        
    }
    
    override func fillCell(_ data: [String:Any?], at index: Int) {
        nameLabel.text = data.getString("cataName")
    }
}
